/*
	Copyright (c) 2010 <copyright holders>
	This source code is licensed under The MIT License,
	see the file LICENSE for details.
	*/

#ifndef GAMEGUI_HPP
#define GAMEGUI_HPP

#include "ForwardDecls.hpp"
#include "HelpDefs.hpp"
#include "WidgetRegistry.hpp"

//forward declarations to save myself compilation time
namespace QuickGUI {
    class EventArgs;
    class GUIManager;
    class Rect;
    class Sheet;
    class Size;
}; //namespace QuickGUI

namespace spelprog2 {

namespace gui {

class GameGUI : protected WidgetRegistry {
    HIDE_EVIL_CONSTRUCTORS(GameGUI);

    QuickGUI::GUIManager * guiMan_;
    const Ogre::Viewport & viewport_;

protected:
    struct FloatRect {
        float l, t, r, b;
    };

    enum AxisAlignment {
        AA_CENTER,
        AA_MIN,
        AA_MAX
    };

    QuickGUI::Sheet * createSheet(const FloatRect & rect, AxisAlignment horizontal = AA_MIN, AxisAlignment vertical = AA_MIN,
        const QuickGUI::Size * maxSize = 0) const;
    static QuickGUI::Rect layoutRect(const FloatRect & src, const QuickGUI::Rect & env);

public:
    GameGUI(Ogre::SceneManager & sceneMan, Ogre::Viewport & viewport);
    virtual ~GameGUI();

    QuickGUI::GUIManager & getManager() { assert(guiMan_); return *guiMan_; }
};

}; //namespace gui
}; //namespace spelprog2

#endif //GAMEGUI_HPP